Problem Note 37843: A name literal defined as ANALYSIS might generate an error when referenced in a COMPUTE block in PROC REPORT
An error similar to the following will be generated when a SAS name literal is defined as an ANALYSIS variable and is referenced in a COMPUTE block using .statistic in PROC REPORT:
ERROR: The variable type of '"123"N.SUM'n is invalid in this context.
The following code with a COMPUTE block will generate the error message:
options validvarname=any;
data example;
"123"n=1;
"456"n=2;
run;
proc report nowd data=example;
col "123"n "456"n total;
define "123"n / "one-three" analysis sum;
define "456"n / "four-six" analysis sum;
compute total;
total="123"n.sum+"456"n.sum;
endcomp;
run;
If the name literal variable value is part of a row total or is used in an IF statement, then defining the name literal as DISPLAY might produce the desired output values. Another approach is to use the column number in the form of _Cn_ in the COMPUTE block. The code would look like the following when using DISPLAY and the _Cn_ form:
options validvarname=any;
data example;
"123"n=1;
"456"n=2;
run;
proc report nowd data=example;
col "123"n "456"n total;
define "123"n / "one-three" display;
define "456"n / "four-six" analysis;
compute total;
total="123"n+_C2_;
endcomp;
run;
Operating System and Release Information
SAS System | Base SAS | z/OS | 9 TS M0 | 9.3 TS1M0 |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9 TS M0 | 9.3 TS1M0 |
Tru64 UNIX | 9 TS M0 | 9.3 TS1M0 |
OpenVMS Alpha | 9 TS M0 | 9.3 TS1M0 |
HP-UX IPF | 9 TS M0 | 9.3 TS1M0 |
Linux | 9 TS M0 | 9.3 TS1M0 |
64-bit Enabled Solaris | 9 TS M0 | 9.3 TS1M0 |
64-bit Enabled HP-UX | 9 TS M0 | 9.3 TS1M0 |
64-bit Enabled AIX | 9 TS M0 | 9.3 TS1M0 |
Microsoft Windows XP Professional | 9 TS M0 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Standard Edition | 9 TS M0 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Enterprise Edition | 9 TS M0 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Datacenter Edition | 9 TS M0 | 9.3 TS1M0 |
Microsoft Windows NT Workstation | 9 TS M0 | |
Microsoft Windows 2000 Professional | 9 TS M0 | |
Microsoft Windows 2000 Server | 9 TS M0 | |
Microsoft Windows 2000 Datacenter Server | 9 TS M0 | |
Microsoft Windows 2000 Advanced Server | 9 TS M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9 TS M0 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9 TS M0 | 9.3 TS1M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
A SAS name literal that is defined as ANALYSIS and is referenced in a COMPUTE block in PROC REPORT with the .statistic might generate an error.
Type: | Problem Note |
Priority: | medium |
Topic: | SAS Reference ==> Procedures ==> REPORT
|
Date Modified: | 2009-11-16 15:05:51 |
Date Created: | 2009-11-16 13:06:06 |